import request from '@/router/axios'

export function fetchList(query) {
  return request({
    url: '/exam/act/task/todo',
    method: 'get',
    params: query
  })
}

export function doneTaskList(query) {
  return request({
    url: '/exam/act/task/doneTask',
    method: 'get',
    params: query
  })
}


export function fetchDetail(id) {
  return request({
    url: '/exam/act/task/' + id,
    method: 'get'
  })
}

export function fetchDetailByProcessId(processId) {
  return request({
    url: '/exam/act/task/getTaskDetailByProcessId/' + processId,
    method: 'get'
  })
}

export function completeTask(obj) {
  return request({
    url: '/exam/act/task/completeTask',
    method: 'post',
    data: obj
  })
}

export function rejectTask(obj) {
  return request({
    url: '/exam/act/task/rejectTask',
    method: 'post',
    data: obj
  })
}

export function doTask(obj) {
  return request({
    url: '/exam/act/task',
    method: 'post',
    data: obj
  })
}

export function fetchComment(id) {
  return request({
    url: '/exam/act/task/comment/' + id,
    method: 'get'
  })
}

/**
 * 审批日志
 * @param processId
 * @returns {AxiosPromise}
 */
export function getActivitiLogs(processId) {
  return request({
    url: '/exam/act/task/getActivitiLogs/' + processId,
    method: 'get',
  })
}

/**
 * 节点列表
 * @param processId
 * @returns {AxiosPromise}
 */
export function listProcessTasks(processId) {
  return request({
    url: '/exam/act/task/listProcessTasks/' + processId,
    method: 'get',
  })
}
